Typically, in computational and measurement apparatus which calculate and display numeric results in the pure fractional format "b/c" (where b and c are integers and respectively represent the numerator and denominator of a fraction), the user of such apparatus is given the option to specify a default denominator to the memory or display. By way of example, if a user were working with length measurements, the user might wish to see results in 16ths. Accordingly, the "c" value (of "b/c") would be set to "16" and all subsequent fraction results will be displayed in 16ths. Unfortunately, in this operation some type of numerical round-off error will occur with respect to the number displayed.
Most fraction calculating techniques will return a fraction whose denominator represents a factor of the stored denominator, i.e., "to the nearest 16th". However, a fixed denominator value of 16 will not permit fraction resolution into thirds, fifths, sevenths and so on even though those fractions may be more accurate than the set fractional value. Other fraction calculating techniques resolve fractions and compare successive representations to a floating point comparison of the decimal values. This operation offers no control over the size of the resulting formatted denominator.
It is therefor an object of the present invention to provide a fraction display mode that, given a decimal (floating-point) value, will display the most accurate fraction representing the value. The displayed fraction will be the most accurate possible where the denominator does not exceed a stored maximum denominator. This allows for a resulting fraction whose denominator is not a factor of the stored denominator.
The present invention uses the method of continued fractions on a term by term basis, comparing the calculated denominator of each term summation against the stored denominator. If more terms exist, and the calculated denominator has not been exceeded, another term is calculated. This method produces a fraction that is already reduced, and each iteration will be more and more accurate until the fraction is perfect or the tolerance is exceeded.
The foregoing and additional features and advantages of the present invention will be more readily apparent from the following detailed description, which proceeds with reference to the accompanying drawings.